<div class="cover">
    <img style="width: 100%;" src="<?php echo DOMAIN;?>img/fill/w971/h300/<?php if(empty($user['cover'])) echo 'cover.png';else echo $user['cover'];?>" />

    <!-- Button to trigger modal -->
    <?php if(isset($_SESSION['user_id'])&&$_SESSION['user_id']==$user['id']){?>
        <a href="#myCover" data-toggle="modal" style="text-decoration: none;"><div class="cover-box"><i style="font-size: 16px;" class="fa fa-camera"></i> <span><?php echo lang('thaydoianhbia');?></span></div></a>
    <?php }?>
        <div class="user-quick">
            <?php
                if(isset($user_login['id'])){
            ?>
                <?php if($user_login['id'] != $user['id']){?>
                    <!--friend-->
                    <?php
                        //neu da la ban cua nhau
                        if(isset($friended)){
                    ?>
                        <a class="btn-group short" href="<?php echo DOMAIN;?>friend/close/<?php echo $user['id'];?>"><button class="btn active"><?php echo lang('huyketban');?></button><button class="btn btn-primary active"><i class="fa fa-list-alt"></i></button></a>
                    <?php }else{?>
                        <a class="btn-group short" href="<?php echo DOMAIN;?>friend/active/<?php echo $user['id'];?>"><button class="btn active"><?php echo lang('ketban');?></button><button class="btn btn-primary active"><i class="fa fa-list-alt"></i></button></a>
                    <?php }?>
                    <div class="clear-content"></div>
                    <!--theo doi-->
                    <?php
                        //neu da la ban cua nhau
                        if(isset($followed)){
                    ?>
                        <a class="btn-group short" href="<?php echo DOMAIN;?>follow/close/<?php echo $user['id'];?>"><button class="btn active"><?php echo lang('huytheodoi');?></button><button class="btn btn-primary active"><i class="fa fa-list-alt"></i></button></a>
                    <?php }else{?>
                        <a class="btn-group short" href="<?php echo DOMAIN;?>follow/active/<?php echo $user['id'];?>"><button class="btn active"><?php echo lang('theodoi');?></button><button class="btn btn-primary active"><i class="fa fa-list-alt"></i></button></a>
                    <?php }?>
                <?php }else{?>
                    <a class="btn-group" href="<?php echo DOMAIN;?>user/info/<?php echo $user_login['id'];?>"><button class="btn active" style="height: 27px;"><?php echo lang('thiet_lap_thong_tin');?></button><button class="btn btn-primary active" style="width: auto; padding: inherit;"><img src="<?php echo DOMAIN;?>images/icon-thietlapthongitn.png" style="max-width: inherit;"/></button></a>
                    <div class="clear-content"></div>
                    <a class="btn-group" href="<?php echo DOMAIN;?>user/pass/<?php echo $user_login['id'];?>"><button class="btn active" style="height: 27px;"><?php echo lang('doi_pass');?></button><button class="btn btn-primary active" style="width: auto; padding: inherit;"><img src="<?php echo DOMAIN;?>images/icon-thietlapmatkhau.png" style="max-width: inherit;"/></button></a>
                <?php }?>
            <?php }else{?>
                <a class="btn-group short" href="<?php echo DOMAIN;?>friend/active/<?php echo $user['id'];?>"><button class="btn active"><?php echo lang('ketban');?></button><button class="btn btn-primary active"><i class="fa fa-list-alt"></i></button></a>
                <div class="clear-content"></div>
                <a class="btn-group short" href="<?php echo DOMAIN;?>follow/active/<?php echo $user['id'];?>"><button class="btn active"><?php echo lang('theodoi');?></button><button class="btn btn-primary active"><i class="fa fa-list-alt"></i></button></a>
            <?php }?>
        </div>

    <!-- Modal -->
    <div id="myCover" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel"><?php echo lang('anh_bia');?></h3>
        </div>
        <form method="post" enctype="multipart/form-data" action="<?php echo DOMAIN;?>user/cover/<?php echo $user['id'];?>">
            <div class="modal-body">
                <div class="member">
                    <div class="row-fluid">
                        <table class="table">
                          <tbody>
                            <tr>
                              <td>
                                <img style="border: 1px dotted #ccc;height: 100px;" src="<?php echo IMG_URL; ?>h100/<?php if(empty($user['cover'])) echo 'cover.png';else echo $user['cover'];?>" /><br />
                                <div class="clear-content"></div>
                                <?php echo $this->Form->input('User.cover',array('type'=>'file', 'accept'=>'image/gif,image/jpeg,image/png','label' => false, 'div' => false, 'legend'=> false));?>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                    </div>
                </div><!--end member-->
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary">Save changes</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            </div>
        </form>
    </div>
</div>
<div class="avatar" style="margin-left: 25px;margin-top: -126px;background: #FFF;border: #ccc solid 2px;width: 164px;position: relative;">
    <img style="width:100%;" src="<?php echo IMG_URL.'fill/w160/h160/'.$user['images'];?>" />

    <!-- Button to trigger modal -->
    <?php if(isset($_SESSION['user_id'])&&$_SESSION['user_id']==$user['id']){?>
        <a href="#myAvatar" data-toggle="modal" style="text-decoration: none;"><div class="avatar-box"><i style="font-size: 16px;" class="fa fa-camera"></i> <span>Cập nhật ảnh đại diện</span></div></a>
    <?php }?>

    <!-- Modal -->
    <div id="myAvatar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel"><?php echo lang('anh_dai_dien');?></h3>
        </div>
        <form method="post" enctype="multipart/form-data" action="<?php echo DOMAIN;?>user/avatar/<?php echo $user['id'];?>">
            <div class="modal-body">
                <div class="member">
                    <div class="row-fluid">
                        <table class="table">
                          <tbody>
                            <tr>
                              <td>
                                <img style="border: 1px dotted #ccc;height: 100px;" src="<?php echo IMG_URL; ?>h100/<?php echo $user_login['images']; ?>" /><br />
                                <div class="clear-content"></div>
                                <?php echo $this->Form->input('User.images',array('type'=>'file', 'accept'=>'image/gif,image/jpeg,image/png','label' => false, 'div' => false, 'legend'=> false));?>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                    </div>
                </div><!--end member-->
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary">Save changes</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            </div>
        </form>
    </div>
</div>

<div class="display-name">
    <?php echo $user['fullname'];?>
</div>

<!--check xem trang nay co phai cua tai khoan dang login ko-->
<div style="position: absolute;margin-left: 200px;margin-top: -34px;margin-bottom: 20px;">
    <span class="rate">
        Xếp hạng: <?php $_SESSION['point'] = $user['point']; echo $this->element('user-star');?>
    </span>

    <span class="point">
        Điểm: <?php echo number_format($user['point'],0,',',' ');?> point
    </span>
    <style>.rate .fa {color: #009DDA;}</style>
</div>

<?php if(isset($_SESSION['user_id'])&&$_SESSION['user_id']==$user['id']){?>
    <center><i><?php echo lang('bandangotrangcuaminh');?></i></center>
<?php }?>

<div>
    <!-- Nav tabs -->
    <ul class="blog-menu nav nav-tabs" role="tablist">
      <?php /*<a href="#home" role="tab" data-toggle="tab">Trang chủ</a>*/?>
      <li <?php if(empty($search) && empty($direct)){?>class="active"<?php }?>><a href="#profile" role="tab" data-toggle="tab">Thông tin</a></li>
      <li <?php if($direct == 'friends'){?>class="active"<?php }?>><a href="#friends" role="tab" data-toggle="tab">Bạn bè</a></li>
      <li><a href="#product" role="tab" data-toggle="tab">Sản phẩm</a></li>
      <li><a href="#post" role="tab" data-toggle="tab">Bài viết</a></li>
      <?php if(!empty($search)){?><li class="active"><a href="#search" role="tab" data-toggle="tab">Tìm kiếm</a></li><?php }?>
    </ul>
</div>


<!-- Tab panes -->
<div class="tab-content">
  <div class="tab-pane" id="home"><?php echo $this->element('blog-home');?></div>
  <div class="tab-pane <?php if(empty($search) && empty($direct)){?>active<?php }?>" id="profile"><?php echo $this->element('blog-profile');?></div>
  <div class="tab-pane <?php if($direct == 'friends'){?>active<?php }?>" id="friends"><?php echo $this->element('blog-friends');?></div>
  <div class="tab-pane" id="post"><?php echo $this->element('blog-post');?></div>
  <div class="tab-pane" id="product"><?php echo $this->element('blog-product');?></div>
  <?php if(!empty($search)){?><div class="tab-pane active" id="search"><?php echo $this->element('blog-search');?></div><?php }?>
</div>

<div class="clear-content"></div>